<!--
  模块：一键求助 - 录入结果 - 首页
-->
<template>
  <div class="help-input">
      <!-- 一键求助 - 分配部门 - 首页 -->
    <!-- 头部搜索栏 -->
    <AppMainHeader>
      <el-row>
        <el-col :span="24">
         <HelpAssignForm
              @query="handleQuery"
              :pulldown="pulldown">
          </HelpAssignForm>
        </el-col>
      </el-row>
    </AppMainHeader>


    <!-- 内容区 -->
    <AppMainContent>
       <!-- 分页表格 -->
        <el-row>
          <el-col :span="24">
            <HelpAssingTable
                :helpAssignList="pageList"
                :currPage="formParams.currPage"
                :pageSize="formParams.pageSize"
                @handleAllocation="handleAllocation"
                @handleDetail="handleDetail"
                ></HelpAssingTable>
          </el-col>
        </el-row>
      <!-- 分页信息 -->
        <Pagination
             v-show="total > 0"
            :total="total"
            :current.sync="formParams.currPage"
            :size.sync="formParams.pageSize"
            @pagination="getList"
         />

         <CopyRight>
         </CopyRight>

    </AppMainContent>



  </div>
</template>

<script>

  // 搜索栏
  import HelpAssignForm from "./components/help-assign-form"
  // 内容表格
  import HelpAssingTable from "./components/help-assign-table"
  // 分页
  import { pageHelpinput , pulldown} from '@/api/help/input'
  //版权
  import CopyRight from "@/components/copyright"
  //起始分页数据请求
  let pageParams = { currPage: 1, pageSize: 15 }

export default {
  name: 'HelpInput',

  components:{
    HelpAssignForm,HelpAssingTable,CopyRight
  },

  created() {
      // 获取表格数据
      this.getList(),
      // 获取头部表单下拉数据
      this.getPulldown()
    },

  data() {
    return {

      //表格数据
      pageList:"",

      //表单下拉数据
      pulldown:{},

      // 表单查询参数
      formParams: { ...pageParams },

      // 总的数据条数
      total:"",

        }
    },

    methods: {
      // 获取表格数据
      getList() {
        pageHelpinput(this.formParams).then((responseTwo) => {
          this.pageList = responseTwo.data;
          this.total = responseTwo.page.total;
          console.log(responseTwo)
        })
      },

      // 获取头部表单下拉数据
      getPulldown(){
               pulldown().then((responseOne)=>{
            this.pulldown = responseOne.data;
        })
      },

      // 跳转详情页面
      handleDetail(scope) {
        this.$router.push({
              name:"HelpreplyInput",
              query: {
			            id: scope
			          }
          })
      },

      // 跳转结果录入页面
      handleAllocation(scope){
          this.$router.push({
              name:"HelpinputAllocation",
              query: {
			            id: scope
			          }
          })
      },


      // 头部表单数据的接收
      handleQuery(formParams) {
         this.formParams = { ...formParams, ...pageParams }
         this.getList()
      },
    },

}
</script>

<style  scoped>






</style>
